using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

//道具球的静态信息，如id、种类等
public struct BallInfo
{
  public int id;

  public static BallInfo Invalid => new BallInfo {
    id = -1
  };

  //总是使用这个函数来创建BallInfo，保证后续信息和id是一一对应的
  public static BallInfo Create(int id) {
    return new BallInfo {
      id = id
    };
  }

  public static bool operator ==(BallInfo a, BallInfo b) {
    return a.id == b.id;
  }

  public static bool operator !=(BallInfo a, BallInfo b) {
    return !(a == b);
  }

  #region Default Override
  public override bool Equals(object obj) {
    return obj is BallInfo info &&
           this == info;
  }

  public override int GetHashCode() {
    return HashCode.Combine(id);
  }
  #endregion
}
